<template>
  <div>
    <!-- 查询区域 -->
    <div class="table-page-search-wrapper">
      <a-form layout="inline" @keyup.enter.native="searchQuery">
        <a-row :gutter="24">
          <a-col :md="6" :sm="8">
            <a-form-item :label="$t('m.system.sysfillrule.entity.ruleName')">
              <a-input placeholder="" v-model="queryParam.ruleName"></a-input>
            </a-form-item>
          </a-col>
          <a-col :md="6" :sm="8">
            <a-form-item :label="$t('m.system.sysfillrule.entity.ruleCode')">
              <a-input placeholder="" v-model="queryParam.ruleCode"></a-input>
            </a-form-item>
          </a-col>
          <a-col :md="6" :sm="8">
            <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
              <a-button type="primary" @click="searchQuery" icon="search">{{ $t('m.common.button.query') }}</a-button>
              <a-button type="default" @click="searchReset" icon="reload" style="margin-left: 8px">{{ $t('m.common.button.reset') }}</a-button>
            </span>
          </a-col>
        </a-row>
      </a-form>
    </div>

    <!-- table区域-begin -->

    <a-table
      ref="table"
      size="middle"
      bordered
      rowKey="id"
      :columns="columns"
      :dataSource="dataSource"
      :pagination="ipagination"
      :loading="loading"
      :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange, type: (radio ? 'radio' : 'checkbox')}"
      @change="handleTableChange">
      <template slot="serialNum" slot-scope="text,record,index">
        {{(ipagination.current-1) * ipagination.pageSize + parseInt(index) + 1}}
      </template>
    </a-table>
    <!-- table区域-end -->
  </div>
</template>

<script>

  import YchConstant from '@/api/YchConstant'
  import { YcListMixin } from '@/mixins/YcListMixin'

  export default {
    name: 'SelectFillRuleList',
    mixins: [YcListMixin],
    props: {
      radio: Boolean,
    },
    data() {
      return {
        columns: [
          {
            title:this.$t('m.common.label.number'),
            dataIndex: '',
            key: 'rowIndex',
            width: 60,
            align: 'center',
            scopedSlots: { customRender: 'serialNum' },
          },
          {
            title: this.$t('m.system.sysfillrule.entity.ruleName'),
            align: 'center',
            dataIndex: 'ruleName'
          },
          {
            title: this.$t('m.system.sysfillrule.entity.ruleCode'),
            align: 'center',
            dataIndex: 'ruleCode'
          },
          {
            title: this.$t('m.system.sysfillrule.entity.ruleClass'),
            align: 'center',
            dataIndex: 'ruleClass'
          }
        ],
        url: {
          list: YchConstant.PREFIX_SYSTEM + '/fillRule/list'
        }
      }
    },
    methods: {}
  }
</script>
<style lang="less" scoped>

</style>
